package com.sls.game.dao.impl;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.sls.game.page.Pagination;
import com.sls.game.querybean.base.BaseQuery;

public class SuperDAO<T> extends SqlSessionDaoSupport {
	/**
	 * 根据记录总数，分页查询相关计算
	 * 
	 * @param rowCount
	 *            符合条件的记录总数
	 * @param list
	 *            记录结果集list
	 * @param query
	 *            当前页和每页显示记录个数对象
	 * @return
	 */
	public Pagination<T> queryPagination(Integer rowCount, List<T> list,
			BaseQuery query) {
		Integer curIndex = query.getCurrentPage();
		Pagination<T> page = new Pagination<T>(curIndex, rowCount,
				query.getPageSize(), list);

		return page;
	}
}
